home *** CD-ROM | disk | FTP | other *** search
- /* source du programme : */
- /* © INTUI-DKB 1.0 */
- /* Sébastien Bouchex */
- /* version 1.0 */
- /* */
- /* - utilisation de req.library */
- /* - compatible avec DKB-Trace 2.0 */
- /* */
-
- #include <stdio.h>
- #include <intuition/intuition.h>
- #include <exec/libraries.h>
- #include <libraries/dosextens.h>
- #include <libraries/dos.h>
- #include <libraries/ReqBase.h>
-
- /* variables chaines utilisées */
- char source_nom[FCHARS]=NULL;
- char source_dir[DSIZE]=NULL;
- char source[DSIZE+FCHARS]=NULL;
- char cible_nom[FCHARS]=NULL;
- char cible_dir[DSIZE]=NULL;
- char cible[DSIZE+FCHARS]=NULL;
- char hauteur[5]=NULL,largeur[5]=NULL,debut[5]=NULL,
- fin[5]=NULL,lissage[5]=NULL,qualite[3]=NULL,tampon[5]=NULL;
- struct ReqFileRequester req_cible=NULL;
- struct ReqFileRequester req_source=NULL;
-
- /* variables du programme */
- struct Window *f1=NULL;
- struct ReqBase *ReqBase=NULL;
- char commande[240]="run ";
- char nom_calcul[10]=NULL;
- char fichier_config[25]="s:intui-dkb1.0.config";
- struct IntuiMessage *im=NULL;
- char drapeau=0;
-
- SHORT BorderVectors1[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
-
- struct Border Border1 = {
- -2,-1,1,0,JAM1,5,BorderVectors1,NULL};
-
- struct IntuiText IText1 = {
- 1,0,JAM2,
- 12,8,
- NULL,
- "SORTIE",
- NULL
- };
-
- struct Gadget Gadget14 = {
- NULL,
- 308,83,
- 73,22,
- NULL,
- RELVERIFY+TOGGLESELECT,
- BOOLGADGET,
- (APTR)&Border1,
- NULL,
- &IText1,
- NULL,
- NULL,
- 14,
- NULL
- };
-
- SHORT BorderVectors2[] = {
- 0,0,
- 106,0,
- 106,25,
- 0,25,
- 0,0
- };
- struct Border Border2 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors2,
- NULL
- };
-
- struct IntuiText IText2 = {
- 1,0,JAM2,
- 7,9,
- NULL,
- "C'EST PARTI",
- NULL
- };
-
- struct Gadget Gadget13 = {
- &Gadget14,
- 150,149,
- 103,24,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border2,
- NULL,
- &IText2,
- NULL,
- NULL,
- 13,
- NULL
- };
-
- SHORT BorderVectors3[] = {
- 0,0,
- 161,0,
- 161,20,
- 0,20,
- 0,0
- };
- struct Border Border3 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors3,
- NULL
- };
-
- struct IntuiText IText3 = {
- 1,0,JAM2,
- 26,6,
- NULL,
- "FICHIER IMAGE",
- NULL
- };
-
- struct Gadget Gadget12 = {
- &Gadget13,
- 207,117,
- 158,19,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border3,
- NULL,
- &IText3,
- NULL,
- NULL,
- 12,
- NULL
- };
-
- SHORT BorderVectors4[] = {
- 0,0,
- 161,0,
- 161,20,
- 0,20,
- 0,0
- };
- struct Border Border4 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors4,
- NULL
- };
-
- struct IntuiText IText4 = {
- 1,0,JAM2,
- 24,6,
- NULL,
- "FICHIER SOURCE",
- NULL
- };
-
- struct Gadget Gadget11 = {
- &Gadget12,
- 31,117,
- 158,19,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border4,
- NULL,
- &IText4,
- NULL,
- NULL,
- 11,
- NULL
- };
-
- SHORT BorderVectors5[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border5 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors5,
- NULL
- };
-
- struct IntuiText IText5 = {
- 1,0,JAM2,
- 12,8,
- NULL,
- "NUMERO",
- NULL
- };
-
- struct Gadget Gadget10 = {
- &Gadget11,
- 216,83,
- 73,22,
- NULL,
- RELVERIFY+TOGGLESELECT,
- BOOLGADGET,
- (APTR)&Border5,
- NULL,
- &IText5,
- NULL,
- NULL,
- 10,
- NULL
- };
-
- SHORT BorderVectors6[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border6 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors6,
- NULL
- };
-
- struct IntuiText IText6 = {
- 1,0,JAM2,
- 9,8,
- NULL,
- "ATTENTE",
- NULL
- };
-
- struct Gadget Gadget9 = {
- &Gadget10,
- 121,83,
- 73,22,
- NULL,
- RELVERIFY+TOGGLESELECT,
- BOOLGADGET,
- (APTR)&Border6,
- NULL,
- &IText6,
- NULL,
- NULL,
- 9,
- NULL
- };
-
- SHORT BorderVectors7[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border7 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors7,
- NULL};
-
- struct IntuiText IText7 = {
- 1,0,JAM2,
- 9,8,
- NULL,
- "AFFICH.",
- NULL
- };
-
- struct Gadget Gadget8 = {
- &Gadget9,
- 28,83,
- 73,22,
- NULL,
- RELVERIFY+TOGGLESELECT,
- BOOLGADGET,
- (APTR)&Border7,
- NULL,
- &IText7,
- NULL,
- NULL,
- 8,
- NULL
- };
-
- SHORT BorderVectors8[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border8 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors8,
- NULL
- };
-
- struct IntuiText IText8 = {
- 1,0,JAM2,
- 13,8,
- NULL,
- "TAMPON",
- NULL
- };
-
- struct Gadget Gadget7 = {
- &Gadget8,
- 260,52,
- 73,22,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border8,
- NULL,
- &IText8,
- NULL,
- NULL,
- 7,
- NULL
- };
-
- SHORT BorderVectors9[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border9 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors9,
- NULL
- };
-
- struct IntuiText IText9 = {
- 1,0,JAM2,
- 9,8,
- NULL,
- "QUALITE",
- NULL
- };
-
- struct Gadget Gadget6 = {
- &Gadget7,
- 164,52,
- 73,22,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border9,
- NULL,
- &IText9,
- NULL,
- NULL,
- 6,
- NULL
- };
-
- SHORT BorderVectors10[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border10 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors10,
- NULL
- };
-
- struct IntuiText IText10 = {
- 1,0,JAM2,
- 9,8,
- NULL,
- "LISSAGE",
- NULL
- };
-
- struct Gadget Gadget5 = {
- &Gadget6,
- 67,52,
- 73,22,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border10,
- NULL,
- &IText10,
- NULL,
- NULL,
- 5,
- NULL
- };
-
- SHORT BorderVectors11[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border11 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors11,
- NULL
- };
-
- struct IntuiText IText11 = {
- 1,0,JAM2,
- 20,8,
- NULL,
- "FIN",
- NULL
- };
-
- struct Gadget Gadget4 = {
- &Gadget5,
- 303,18,
- 73,22,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border11,
- NULL,
- &IText11,
- NULL,
- NULL,
- 4,
- NULL
- };
-
- SHORT BorderVectors12[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border12 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors12,
- NULL
- };
-
- struct IntuiText IText12 = {
- 1,0,JAM2,
- 15,8,
- NULL,
- "DEBUT",
- NULL
- };
-
- struct Gadget Gadget3 = {
- &Gadget4,
- 212,18,
- 73,22,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border12,
- NULL,
- &IText12,
- NULL,
- NULL,
- 3,
- NULL
- };
-
- SHORT BorderVectors13[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border13 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors13,
- NULL
- };
-
- struct IntuiText IText13 = {
- 1,0,JAM2,
- 9,8,
- NULL,
- "LARGEUR",
- NULL
- };
-
- struct Gadget Gadget2 = {
- &Gadget3,
- 119,18,
- 73,22,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border13,
- NULL,
- &IText13,
- NULL,
- NULL,
- 2,
- NULL
- };
-
- SHORT BorderVectors14[] = {
- 0,0,
- 76,0,
- 76,23,
- 0,23,
- 0,0
- };
- struct Border Border14 = {
- -2,-1,
- 1,0,JAM1,
- 5,
- BorderVectors14,
- NULL
- };
-
- struct IntuiText IText14 = {
- 1,0,JAM2,
- 9,8,
- NULL,
- "HAUTEUR",
- NULL
- };
-
- struct Gadget Gadget1 = {
- &Gadget2,
- 26,18,
- 73,22,
- NULL,
- RELVERIFY,
- BOOLGADGET,
- (APTR)&Border14,
- NULL,
- &IText14,
- NULL,
- NULL,
- 1,
- NULL
- };
-
- struct NewWindow NewWindowStructure1 = {
- 166,11,
- 423,182,
- 0,3,
- GADGETUP|CLOSEWINDOW,
- WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE,
- &Gadget1,
- NULL,
- "INTUI-DKB 1.0 Sébastien BOUCHEX",
- NULL,
- NULL,
- 5,5,
- 640,200,
- WBENCHSCREEN
- };
-
-
- /* saisie fichier source et cible par requêtes fichiers */
- void fichier_source()
- {
- req_source.PathName = source ;
- req_source.Dir = source_dir;
- req_source.File = source_nom;
-
- req_source.Flags = FRQCACHINGM ;
-
- req_source.dirnamescolor = 2;
- req_source.devicenamescolor = 2;
-
- FileRequester(&req_source);
-
- PurgeFiles(&req_source);
-
- }
-
- void fichier_cible()
- {
- req_cible.PathName = cible ;
- req_cible.Dir = cible_dir;
- req_cible.File = cible_nom;
-
- req_cible.Flags = FRQCACHINGM ;
-
- req_cible.dirnamescolor = 2;
- req_cible.devicenamescolor = 2;
-
- FileRequester(&req_cible);
-
- PurgeFiles(&req_cible);
- }
-
- void saisie_hauteur()
- {
- GetString (hauteur,"HAUTEUR",(struct Window *)0L,10,4);
- }
-
- void saisie_largeur()
- {
- GetString (largeur,"LARGEUR",(struct Window *)0L,10,4);
- }
-
- void saisie_debut()
- {
- GetString (debut,"DEBUT",(struct Window *)0L,10,4);
- }
-
- void saisie_fin()
- {
- GetString (fin,"FIN",(struct Window *)0L,10,4);
- }
-
- void saisie_qualite()
- {
- GetString (qualite,"QUALITE",(struct Window *)0L,11,2);
- }
-
- void saisie_tampon()
- {
- GetString (tampon,"TAMPON",(struct Window *)0L,10,4);
-
- }
-
- void saisie_lissage()
- {
- GetString (lissage,"LISSAGE",(struct Window *)0L,14,4);
- }
-
- void feu()
- {
- drapeau=1;
- strcat (commande,nom_calcul);
- strcat (commande," -i");
- if (source[0]!=0)
- strcat (commande,source);
-
- if (strcmp (hauteur,"")) {
- strcat (commande," -h");
- strcat (commande,hauteur);
- }
-
- if (strcmp (largeur,"")) {
- strcat (commande," -w");
- strcat (commande,largeur);
- }
-
- if (strcmp (debut,"")) {
- strcat (commande," -s");
- strcat (commande,debut);
- }
-
- if (strcmp (fin,"")) {
- strcat (commande," -e");
- strcat (commande,fin);
- }
-
- if (strcmp (lissage,"")) {
- strcat (commande," +a");
- strcat (commande,lissage);
- }
-
- if (strcmp (tampon,"")) {
- strcat (commande," -b");
- strcat (commande,tampon);
- }
-
- if (strcmp (qualite,"")) {
- strcat (commande," -q");
- strcat (commande,qualite);
- }
-
- if ((Gadget8.Flags & SELECTED)==SELECTED)
- strcat (commande," +d");
- else strcat (commande," -d");
-
- if ((Gadget9.Flags & SELECTED)==SELECTED)
- strcat (commande," +p");
- else strcat (commande," -p");
-
- if ((Gadget14.Flags & SELECTED)==SELECTED) {
- strcat (commande," +f -o");
- strcat (commande,cible);
- }
- else strcat (commande," -f");
-
- if ((Gadget10.Flags & SELECTED)==SELECTED)
- strcat (commande," +v");
- else strcat (commande," -v");
-
- strcat (commande," >con:0/0/640/200/DKB-Trace");
-
- Execute (commande,NULL,Output());
- }
-
- void ferme()
- {
- if (f1) CloseWindow(f1);
- if (ReqBase) CloseLibrary(ReqBase);
- }
-
- void charge_config()
- {
- FILE *config=NULL;
-
- if ((config=fopen(fichier_config,"rt"))==NULL)
- {
- SimpleRequest ("impossible de charger le fichier de configuration");
- exit(15);
- }
- fscanf (config,"%s %s %s",nom_calcul,source_dir,cible_dir);
- fclose (config);
- }
-
- void ouvre()
- {
- if ((ReqBase = (struct ReqBase *)OpenLibrary ("req.library",REQVERSION))==0)
- {
- fprintf (stderr,"impossible d'ouvrir la librairie REQ\n");
- exit(15);
- }
- f1 = (struct Window *)OpenWindow (&NewWindowStructure1);
-
- }
-
- void wbmain()
- {
- int nb;
- atexit (ferme);
-
- ouvre();
- charge_config();
- do
- {
- Delay (5);
- while (im=(struct IntuiMessage *) GetMsg(f1->UserPort))
- switch (im->Class)
- {
- case CLOSEWINDOW :
- ReplyMsg(im);
- exit(0);
- case GADGETUP :
- nb=((struct Gadget *)im->IAddress)->GadgetID;
- if (nb==13) feu();
- if (nb==12) fichier_cible();
- if (nb==11) fichier_source();
- if (nb==1) saisie_hauteur();
- if (nb==2) saisie_largeur();
- if (nb==3) saisie_debut();
- if (nb==4) saisie_fin();
- if (nb==5) saisie_lissage();
- if (nb==6) saisie_qualite();
- if (nb==7) saisie_tampon();
- if (drapeau==1)
- {
- ReplyMsg(im);
- exit(0);
- }
- }
- }
- while (TRUE);
- }
-
- void main()
- {
- wbmain();
- }
-